package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.OrderAddress;
import com.itheima.service.OrderService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order_address")
public class OrderController {
    @Reference
    private OrderService orderService;

    @RequestMapping("/selectAllByName")
    public PageResult selectAllByName(@RequestBody QueryPageBean queryPageBean){
        return orderService.selectAllByName(queryPageBean);
    }
    @RequestMapping("/add")
    public Result add(@RequestBody OrderAddress orderAddress){
        return orderService.add(orderAddress);
    }
    @RequestMapping("/updateOne")
    public Result updateOne(@RequestBody OrderAddress orderAddress){
        return orderService.updateOne(orderAddress);
    }
    @RequestMapping("/deleteById")
    public Result deleteById(int id){
        return orderService.deleteById(id);
    }
}
